Skip to content

feat(output): hyperlink URL table cells - #825

Merged
platinummonkey merged 1 commit into
DataDog:mainfrom
bobthecow:feat/table-hyperlinks
Sep 16, 2026
Merged

platinummonkey merged 1 commit into
DataDog:mainfrom
bobthecow:feat/table-hyperlinks

Conversation

@bobthecow

Copy link
Copy Markdown
Contributor

Motivation

Table values are deliberately shortened to keep output readable, but that makes URL cells less useful, as the visible value no longer contains the complete target. This means even if a terminal is set up to allow hyperlink clicks, it'll be the entirely wrong URL.

Terminals already have a way to separate a compact label from its destination: OSC 8 links let us keep the existing table layout while making the original URL available on hover or click.

Changes

When stdout is an interactive terminal, Pup now makes valid HTTP(S) strings that occupy an entire table cell clickable. The displayed value keeps its existing compact preview, while the link target uses the complete original URL. This applies to horizontal, vertical, and scalar tables.

Only whole-cell URL strings are linked. URLs embedded in prose or array previews remain ordinary text, and malformed or non-HTTP(S) targets are rejected.

Links are disabled in agent mode and redirected or piped output. NO_COLOR, CLICOLOR=0, and TERM=dumb keep output plain, and PUP_HYPERLINKS=0 provides a link-specific opt-out.

OSC 8 adds behavior, not decoration, so static output is intentionally unchanged.

Before

image

After (hover)

image

Implementation question

This enables comfy_table's custom_styling feature so OSC 8 control sequences don't count toward table width. That's much simpler and less error-prone than maintaining a custom post-render pass, but the feature applies ANSI-aware width calculation to every native table, including tables without links. comfy_table documents roughly 30–50% slower table formatting, and enabling it adds eight transitive dependencies.

Is that an acceptable tradeoff for Pup, or would you prefer a narrower implementation?

QA

  • Render a long HTTP(S) value with --output table, hover or click the shortened label, and confirm it uses the complete original URL.
  • Render horizontal, vertical, and scalar tables containing whole-cell URLs and confirm each is linked.
  • Render a URL embedded in prose or an array preview and confirm it remains ordinary text.
  • Set PUP_HYPERLINKS=0, NO_COLOR=1, or CLICOLOR=0 and confirm no OSC 8 sequences are emitted.
  • Pipe table output to another command and confirm it remains plain.

Automated coverage verifies terminal capability detection, full targets behind shortened labels, each table layout, unsafe and embedded URL rejection, opt-outs, and preservation of invisible Unicode separators.

  • cargo test -- --test-threads=1 — 2,004 passed
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings

Blast Radius

Interactive human table output, plus the comfy_table width-calculation path for all native tables. JSON, YAML, CSV, TSV, agent output, and serialized values are unchanged.

@bobthecow
bobthecow requested a review from a team as a code owner September 15, 2026 18:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-16T14:44:28.192077Z d5f8200 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dae4fa6493

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/output.rs Outdated
@bobthecow
bobthecow force-pushed the feat/table-hyperlinks branch from dae4fa6 to ccc7947 Compare September 15, 2026 19:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccc79478d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/output.rs Outdated
platinummonkey
platinummonkey previously approved these changes Sep 15, 2026
Render standalone HTTP and HTTPS string values as OSC 8 links when table output is sent to an interactive terminal. Keep the original URL as the link target when the displayed cell is truncated, while leaving embedded URLs and non-interactive output unchanged.\n\nHonor the existing styling opt-outs and add PUP_HYPERLINKS=0 for users who want colors without links.
@platinummonkey
platinummonkey merged commit 0a612de into DataDog:main Sep 16, 2026
6 checks passed
@bobthecow
bobthecow deleted the feat/table-hyperlinks branch September 16, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants